package com.bootdo.appsystem.service.impl;

import com.bootdo.app.utils.redis.AppRedisUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.bootdo.appsystem.dao.SellercategoryDao;
import com.bootdo.appsystem.domain.SellercategoryDO;
import com.bootdo.appsystem.service.SellercategoryService;



@Service
public class SellercategoryServiceImpl implements SellercategoryService {
	@Autowired
	private SellercategoryDao sellercategoryDao;
	
	@Override
	public SellercategoryDO get(Integer secid){
		return sellercategoryDao.get(secid);
	}
	
	@Override
	public List<SellercategoryDO> list(Map<String, Object> map){
		return sellercategoryDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return sellercategoryDao.count(map);
	}
	
	@Override
	public int save(SellercategoryDO sellercategory){
		return sellercategoryDao.save(sellercategory);
	}
	
	@Override
	public int update(SellercategoryDO sellercategory){
		return sellercategoryDao.update(sellercategory);
	}
	
	@Override
	public int remove(Integer secid){
		return sellercategoryDao.remove(secid);
	}
	
	@Override
	public int batchRemove(Integer[] secids){
		return sellercategoryDao.batchRemove(secids);
	}

	@Override
	public List<SellercategoryDO> getIndexList() {
		List<SellercategoryDO> indexSellercategoryList = null;
		indexSellercategoryList = AppRedisUtil.get("indexSellercategoryList");
		if (indexSellercategoryList == null) {
			HashMap<String, Object> map = new HashMap<>();
			map.put("sort" , "TopID");
			map.put("order" , "ASC");
			indexSellercategoryList = this.list(map);
			AppRedisUtil.put("indexSellercategoryList",indexSellercategoryList);
		}
		return indexSellercategoryList;
	}

}
